{{ $alpineJsVersion := site.Params.alpine_js_version }}
<script src="https://cdn.jsdelivr.net/gh/alpinejs/alpine@v{{ $alpineJsVersion }}/dist/alpine-ie11.js" defer></script>

{{/* Algolia DocSearch JS */}}
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.js"></script>
<script type="text/javascript">
  docsearch({
    apiKey: 'a1ac053087a2434d93fa11c329a47adb',
    indexName: 'goharbor',
    inputSelector: '#search-bar',
    debug: false
  });
</script>

{{/* Anchor link scroll offset */}}
<script>
  const navbarHeight = document.getElementsByClassName('navbar')[0].offsetHeight;
  const extraPadding = 15;
  const navbarOffset = -1 * (navbarHeight + extraPadding);
  var shiftWindow = function() { scrollBy(0, navbarOffset) };
  window.addEventListener("hashchange", shiftWindow);
  window.addEventListener("pageshow", shiftWindow);
  function load() { if (window.location.hash) shiftWindow(); }

  console.log("OK");
</script>